//全选中与全不选中职位资料
function checkAll(form) {
    if (form.checked == true) {
        for (var i = 0; i < document.thisForm.elements.length; i++) {
            var e = document.thisForm.elements[i];
            if (e.name == 'selected_id[]' || e.name == 'selectAll')
                e.checked = true;
        }
    } else {
        for (var i = 0; i < document.thisForm.elements.length; i++) {
            var e = document.thisForm.elements[i];
            if (e.name == 'selected_id[]' || e.name == 'selectAll')
                e.checked = false;
        }
    }
}

//多选操作
function showConfirm(actionUrl, type) {
    var flag = false; //是否有选择职位信息
    for (i = 0; i < document.thisForm.elements.length; i++) {
        if (document.thisForm.elements[i].name == "selected_id[]") {
            if (document.thisForm.elements[i].checked == true) {
                flag = true;
                break;
            }
        }
    }
    if (flag == false) {
        layer.msg("请至少选择一个应聘记录进行相关操作！", {time: 1000});
        return false;
    }
    else if (type == 'employ') {
        layer.confirm('您真的要录用选中的应聘者吗？', {
            btn: ['确定', '取消'] //按钮
        }, function () {
            document.thisForm.action = actionUrl;
            document.thisForm.submit();
        });
    }
    else if (type == 'declined') {
        layer.confirm('您真的要婉拒选中的应聘者吗？', {
            btn: ['确定', '取消'] //按钮
        }, function () {
            document.thisForm.action = actionUrl;
            document.thisForm.submit();
        });
    }
    else if (type == 'delete') {
        layer.confirm('您真的要删除选中的应聘记录吗？', {
            btn: ['确定', '取消'] //按钮
        }, function () {
            document.thisForm.action = actionUrl;
            document.thisForm.submit();
        });
    }
}

//单条操作
function destroy(url, message) {
    layer.confirm(message, {
        btn: ['确定', '取消'] //按钮
    }, function () {
        window.location = url;
    });
}
